package com.bjtech.dao.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;
import org.ssi.dao.impl.BaseDaoSqlMapImpl;

import com.bjtech.dao.AssignMeterInfoDao;
import com.bjtech.domain.AssignMeterInfo;

/**
 * @author wf
 *
 */
@Repository(value="assignMeterInfoDao")
public class SqlMapAssignMeterInfoDao extends BaseDaoSqlMapImpl<AssignMeterInfo> implements
		AssignMeterInfoDao {

	public List selectAssignMeterListByRoomId(Long id) {
		return super.getSqlMapClientTemplate().queryForList("selectAssignMeterListByRoomId",id);
	}

	public AssignMeterInfo selectAssignMeterInfoBySinkId(Long sinkId) {
		return (AssignMeterInfo)super.getSqlMapClientTemplate().queryForObject("selectAssignMeterInfoBySinkId",sinkId);
	}

	public Map selectTjParamForAssignMeterInfo(Long assignMeterId) {
		Map tjParam = new HashMap();
		
		// 所属项目
		String projName = (String) super.getSqlMapClientTemplate()
				.queryForObject("selectProjNameInfoForAssginMeter", assignMeterId);
		tjParam.put("projName", projName);
		// 所属小区
		String xqName = (String) super.getSqlMapClientTemplate()
				.queryForObject("selecXqNameInfoForAssginMeter", assignMeterId);
		tjParam.put("xqName", xqName);
		// 所属楼栋
		String buildingName = (String) super.getSqlMapClientTemplate()
				.queryForObject("selectBudinglindNameInfoForAssginMeter", assignMeterId);
		tjParam.put("buildingName", buildingName);
		
		return tjParam;
	}

}
